package com.briup.ch11;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.util.Scanner;

/**
 * @Author briup-adam
 * @Date 2023/10/20 上午8:32
 * @Description
 **/

public class StandardStreams {
    public static void main(String[] args) {

        //获取标准输入流的实际类型
        System.out.println(System.in.getClass());
        try {
            FileInputStream fis = new FileInputStream("a.txt");
            BufferedInputStream bis = new BufferedInputStream(fis);
            System.out.println("请输入你喜欢的一句歌词");
            Scanner sc = new Scanner(fis);
            System.out.println(sc.next());
            System.setIn(bis);
            PrintStream ps = new PrintStream("a.txt");
            System.setOut(ps);
            System.out.println("春风得意马蹄疾 一日看尽长安花");
           System.setOut(System.err);
            System.out.println("乘风破浪会有时 直挂云帆济沧海");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
